/*
This code creates Figure 2,
the time series of MA penetration weighted by 2011 eligibles at the county level,
dichotomized by benchmark cuts at the 75th percentile
*/

log using "$logs\Fig2.txt", replace text name(fig2)

use "$data_deri\enroll_panel", clear

collapse wPen = penetration [aweight=eligibles11], by(year q4_prop_flag)
xtset q4_prop_flag year

xtline wPen, overlay recast(connected) graphregion(color(white)) plot1opt(lpattern(dash)) scheme(burd) ///
ytitle("Medicare Advantage Penetration (%)") ylabel(15(5)45) ttitle("Year") tlabel(2008(1)2019) ///
tline(2011.5, lcolor(gray)) text(45 2011.5 "ACA Benchmark" "Reductions Begin", box height(10) bcolor(white)) ///
tline(2016.5, lcolor(gray)) text(45 2016.5 "ACA Benchmark Reductions" "Fully Phased In", box height(10) bcolor(white)) ///
legend(order(2 "Counties with the Largest Cuts" "(>75th percentile)" 1 "Counties with Smaller Cuts" "({&le}75th percentile)"))

graph export "$output\Fig2.pdf", replace

log close fig2
